﻿using System;
using System.Globalization;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace HotelManager.Converters
{
    public class ImageConverter 
   {
       public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
      {
           BitmapImage bi = new BitmapImage();//create bitmap image
           if (value != null)
          {
               if (value != null)
                   bi.SetSource(new MemoryStream((Byte[])value));
    
             return bi;
          }
          return bi;
      }
    
      public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
      {
          throw new NotImplementedException("PropertyViewer does not use ConvertBack.");
      }
   }
}
